<!DOCTYPE html>
<html lang="en">
<head><meta name="generator" content="Hexo 3.9.0">
    <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">

    <meta name="description" content="冯同学的博客">


    <meta name="keywords" content="冯同学的博客">


<title>Hexo安装部署教程 | 冯同学的博客</title>



    <link rel="icon" href="/blog/favicon.ico">




    <!-- stylesheets list from _config.yml -->
    
    <link rel="stylesheet" href="/blog/css/style.css">
    



    <!-- scripts list from _config.yml -->
    
    <script src="/blog/js/script.js"></script>
   
  
    
    <script src="/blog/js/tocbot.min.js"></script>
   
  
    
    <script src="/blog/js/clicklove.js"></script>
   
  
    
    <script src="/blog/js/clicksocialvalue.js"></script>
   
  
    



    
    
        
    


</head>
<body>
    <div class="wrapper">
        <header>
    <nav class="navbar">
        <div class="container">
            <div class="navbar-header header-logo"><a href="/blog/">冯同学的Blog</a></div>
            <div class="menu navbar-right">
                
                    <a class="menu-item" href="/blog/archives">帖子</a>
                
                    <a class="menu-item" href="/blog/tag">标签</a>
                
                    <a class="menu-item" href="/blog/友链">友链</a>
                
                    <a class="menu-item" href="/blog/关于">关于</a>
                
                <input id="switch_default" type="checkbox" class="switch_default">
                <label for="switch_default" class="toggleBtn"></label>
            </div>

        </div>
    </nav>

    
    <nav class="navbar-mobile" id="nav-mobile">
        <div class="container">
            <div class="navbar-header">
                <div>
                    <a href="/blog/">冯同学的Blog</a><a id="mobile-toggle-theme">·&nbsp;Light</a>
                </div>
                <div class="menu-toggle" onclick="mobileBtn()">&#9776; Menu</div>
            </div>
            <div class="menu" id="mobile-menu">
                
                    <a class="menu-item" href="/blog/archives">帖子</a>
                
                    <a class="menu-item" href="/blog/tag">标签</a>
                
                    <a class="menu-item" href="/blog/友链">友链</a>
                
                    <a class="menu-item" href="/blog/关于">关于</a>
                
            </div>
        </div>
    </nav>

</header>
<script>

var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "https://hm.baidu.com/hm.js?763ce62c604e21949386b5a3e9533b17";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();

    var mobileBtn = function f() {
        var toggleMenu = document.getElementsByClassName("menu-toggle")[0];
        var mobileMenu = document.getElementById("mobile-menu");
        if(toggleMenu.classList.contains("active")){
           toggleMenu.classList.remove("active")
            mobileMenu.classList.remove("active")
        }else{
            toggleMenu.classList.add("active")
            mobileMenu.classList.add("active")
        }
    }
</script>
        <div class="main">
            <div class="container">
    
    
        <div class="post-toc">
    <div class="tocbot-list">
    </div>
    <div class="tocbot-list-menu">
        <a class="tocbot-toc-expand" onclick="expand_toc()">Expand all</a>
        <a onclick="go_top()">Back to top</a>
        <a onclick="go_bottom()">Go to bottom</a>
    </div>
</div>

<script>
    document.ready(
        function () {
            tocbot.init({
                tocSelector: '.tocbot-list',
                contentSelector: '.post-content',
                headingSelector: 'h1, h2, h3, h4, h5',
                collapseDepth: 1,
                orderedList: false,
                scrollSmooth: true,
            })
        }
    )

    function expand_toc() {
        var b = document.querySelector(".tocbot-toc-expand");
        tocbot.init({
            tocSelector: '.tocbot-list',
            contentSelector: '.post-content',
            headingSelector: 'h1, h2, h3, h4, h5',
            collapseDepth: 6,
            orderedList: false,
            scrollSmooth: true,
        });
        b.setAttribute("onclick", "collapse_toc()");
        b.innerHTML = "Collapse all"
    }

    function collapse_toc() {
        var b = document.querySelector(".tocbot-toc-expand");
        tocbot.init({
            tocSelector: '.tocbot-list',
            contentSelector: '.post-content',
            headingSelector: 'h1, h2, h3, h4, h5',
            collapseDepth: 1,
            orderedList: false,
            scrollSmooth: true,
        });
        b.setAttribute("onclick", "expand_toc()");
        b.innerHTML = "Expand all"
    }

    function go_top() {
        window.scrollTo(0, 0);
    }

    function go_bottom() {
        window.scrollTo(0, document.body.scrollHeight);
    }

</script>
    

    
    <article class="post-wrap">
        <header class="post-header">
            <h1 class="post-title">Hexo安装部署教程</h1>
            
                <div class="post-meta">
                    
                        作者: <a itemprop="author" rel="author">冯同学</a>
                    

                    
                        <span class="post-time">
                      &nbsp;&nbsp;日期: <a>八月 20, 2019&nbsp;&nbsp;22:10:09</a>
                        </span>
                    
                    
                </div>
            
        </header>

        <div class="post-content">
            <h1 id="Hexo-Installation-Tutorial"><a href="#Hexo-Installation-Tutorial" class="headerlink" title="Hexo-Installation-Tutorial"></a>Hexo-Installation-Tutorial</h1><h1 id="Hexo安装教程"><a href="#Hexo安装教程" class="headerlink" title="Hexo安装教程"></a>Hexo安装教程</h1><ul>
<li>教程声明:本篇教程所有涉及到的资源和引用，均由原网站保留解释权</li>
<li>本文作者不会承担任何安装为你带来的烦恼，但是会给你们做疑难解答，请到<a href="https://github.com/dabai2017/Hexo-Installation-Tutorial/issues" target="_blank" rel="noopener">Issues</a>提问。</li>
<li>本文发行版只有中文版，后续会翻译为其他语言版本</li>
</ul>
<h1 id="hexo官方站"><a href="#hexo官方站" class="headerlink" title="hexo官方站"></a>hexo官方站</h1><p><a href="https://hexo.io/zh-cn/" target="_blank" rel="noopener">https://hexo.io/zh-cn/</a></p>
<h1 id="欢迎"><a href="#欢迎" class="headerlink" title="欢迎"></a>欢迎</h1><p>欢迎观看hexo完整安装教程，我是作者大白2017</p>
<ul>
<li>由于win和Android这两种平台，只是所需软件不同，其他操作基本相似，所以本篇教程只讲win平台，当然，本篇教程理论上也适用于其他操作系统</li>
</ul>
<h1 id="下载所需"><a href="#下载所需" class="headerlink" title="下载所需"></a>下载所需</h1><h3 id="Windows所需"><a href="#Windows所需" class="headerlink" title="Windows所需"></a>Windows所需</h3><p><a href="https://git-scm.com/download/" target="_blank" rel="noopener">git桌面版</a><br><a href="https://dabai2017.lanzoui.com/ifxtRr519wj" target="_blank" rel="noopener">node.js</a><br><a href="https://www.typora.io/#download" target="_blank" rel="noopener">用来编写MD文档的typora</a></p>
<h3 id="Android所需"><a href="#Android所需" class="headerlink" title="Android所需"></a>Android所需</h3><p><a href="https://www.lanzoui.com/i5ceiaj" target="_blank" rel="noopener">Termux终端</a><br><a href="https://www.coolapk.com/apk/com.dabai.markdownq" target="_blank" rel="noopener">用来编写MD文档的MarkdownQ</a></p>
<h3 id="hexo完整包"><a href="#hexo完整包" class="headerlink" title="hexo完整包"></a>hexo完整包</h3><p>通过git拉取：<a href="https://gitee.com/dabai2017/hexo-package.git" target="_blank" rel="noopener">https://gitee.com/dabai2017/hexo-package.git</a><br><a href="https://www.lanzoui.com/b881565" target="_blank" rel="noopener">蓝奏云下载</a></p>
<h3 id="需要账户"><a href="#需要账户" class="headerlink" title="需要账户"></a>需要账户</h3><ul>
<li>这篇教程讲的是<strong>将完整hexo部署到git代码托管服务</strong>。所以你需要一个<a href="https://github.com" target="_blank" rel="noopener">github</a>账号，当然也可以是<a href="https://gitee.com" target="_blank" rel="noopener">码云</a>的账号。</li>
</ul>
<h1 id="部署教程开始"><a href="#部署教程开始" class="headerlink" title="部署教程开始"></a>部署教程开始</h1><blockquote>
<p>本次部署,只讲Windows,Android同理,只是安装nodejs有点区别</p>
</blockquote>
<ol>
<li><a href="https://dabai2017.lanzoui.com/ifxtRr519wj" target="_blank" rel="noopener">安装node.js</a></li>
<li><a href="https://git-scm.com/download/" target="_blank" rel="noopener">安装git客户端</a></li>
<li>git客户端分为bash和gui两部分，下面所讲的git是bash命令行</li>
<li>使用git输入下面命令</li>
</ol>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">npm install hexo-cli -g</span><br><span class="line">git config --global user.name &quot;git用户名&quot;</span><br><span class="line">git config --global user.email &quot;git绑定的邮箱地址&quot;</span><br><span class="line">ssh-keygen -t rsa -C &quot;git绑定的邮箱地址&quot;</span><br><span class="line">cd ~/.ssh</span><br><span class="line">cat id_rsa.pub</span><br></pre></td></tr></table></figure>

<ol start="6">
<li>这样就可以得到<strong>本机ssh公钥</strong></li>
<li>打开码云的<strong>设置-安全设置-ssh公钥</strong></li>
<li>标题随便写，内容填<strong>本机的ssh</strong></li>
<li>点击确定保存</li>
<li>然后在码云创建一个<strong>仓库(最好命名为blog)</strong>，拿到<strong>ssh链接</strong></li>
<li>现在把刚刚下载的<strong>hexo-chic修改版.zip</strong>解压，如果是拉取的git就不需要解压了</li>
<li>打开<strong>/hexo-chic/_config.yml</strong>，定位到最后一部分，把刚刚的ssh链接复制到那里，然后把root的值改成仓库名，不然找不到目录也是404</li>
<li>打开git输入 npm install 安装所有插件就可以直接部署hexo到码云了，但码云部署完需要手动更新一下。</li>
<li>打开git输入以下命令就可以部署了</li>
</ol>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">cd /hexo-chic</span><br><span class="line">hexo g</span><br><span class="line">hexo d</span><br></pre></td></tr></table></figure>

<ol start="15">
<li>然后打开<strong>码云-你的博客仓库-服务-Gitee Pages</strong>，没有打开的就开启，已经<strong>开启</strong>的后续每次部署完都要手动点击<strong>更新</strong>才能生效，如果已经就绪，就会显示*<em>已开启 Gitee Pages Pro 服务，网站地址： https://你的用户名.gitee.io/blog *</em></li>
<li>你可以点击那个网站地址来查看你的博客最初的样子</li>
</ol>
<h1 id="总结"><a href="#总结" class="headerlink" title="总结"></a>总结</h1><p>一共5步：环境准备，下载hexo包，设置ssh公钥，设置ssh链接和root目录，最后生成部署。</p>
<h3 id="技术支持"><a href="#技术支持" class="headerlink" title="技术支持"></a>技术支持</h3><p>如果有哪些不懂的,可以给我发邮件 : <a href="mailto:1904812793@qq.com" target="_blank" rel="noopener">1904812793@qq.com</a></p>

        </div>

        
        <section class="post-tags">
            <div>
                <span>Tag:</span>
                <span class="tag">
                    
                    
                        <a href="/blog/tags/教程篇/">#教程篇</a>
                    
                        
                </span>
            </div>
            <div>
                <a href="javascript:window.history.back();">back</a>
            </div>
        </section>
        <section class="post-nav">
            
                <a class="prev" rel="prev" href="/blog/2019/08/22/机型修改社区支持/">机型修改社区支持</a>
            
            
        </section>


    </article>
</div>

        </div>
        
    </div>
   
   </body>
</html>
